#ifndef _AUDIO_MANAGER_H_
#define _AUDIO_MANAGER_H_

#include "esp_err.h"
#include "audio_player.h"
#include "esp_codec_dev.h"
#include "esp_codec_dev_defaults.h"

#ifdef __cplusplus
extern "C" {
#endif

typedef enum {
    AUDIO_SET_SPEAKER_RATE = 0,
    AUDIO_SET_MICROPHONE_RATE,
} audio_set_rate_t;

esp_err_t audio_manager_set_sampling_rate(uint32_t rate, uint32_t bits_cfg, i2s_slot_mode_t ch);
esp_err_t audio_manager_i2s_write(void *audio_buffer, size_t len, size_t *bytes_written, uint32_t timeout_ms);
esp_err_t audio_manager_set_mute(bool enable);
esp_err_t audio_manager_set_volume(int volume, int *volume_set);
esp_err_t audio_manager_i2s_read(void *audio_buffer, size_t len, size_t *bytes_read, uint32_t timeout_ms);
esp_err_t audio_manager_set_in_gain(int gain, int *volume_set);
esp_err_t audio_manager_close();

int audio_manager_init(void);

#ifdef __cplusplus
}
#endif

#endif /* _AUDIO_MANAGER_H_ */